package com.huawei.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ScanFile {
    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        //conf.set("fs.defaultFS", "hdfs://master:9000");
        FileSystem fs = FileSystem.get(conf);
        Path path = new Path(args[0]);
        FSDataInputStream red = fs.open(path);
        BufferedReader bf = new BufferedReader(new InputStreamReader(red));
        String line = null;
        while ((line = bf.readLine()) != null){
            System.out.println(line);
        }
        bf.close();
        red.close();
        fs.close();
    }
}